package com.hxkj.domain.enums;

import com.platform.common.domain.exception.CustomExceptionCode;

/**
 * 用户异常枚举
 * <p>
 * Created by chenwei on 2017/6/21.
 */
public enum FriendlyLinkExceptionEnum implements CustomExceptionCode {
   //异常枚举
   FRIENDLYLINK_SAVE_ERROR(600, "友情链接保存异常", 900),
    FRIENDLYLINK_DELETE_ERROR(601, "友情链接删除异常", 900),
    FRIENDLYLINK_QUERY_ERROR(602, "友情链接获取异常", 900),
    FRIENDLYLINK_EXIST_ALREADY(603, "友情链接已存在", 900),
    PARAMETER_IS_NULL(604,"输入参数异常",900),
    FRIENDLYLINK_IS_NULL(605, "友情链接不存在", 900),
    LINKURL_IS_NULL(606, "链接地址不能为空", 900),
    FRIENDLYLINK_UPDATE_ERROR(607, "友情链接更新异常", 900),



    ;

    private Integer code;
    private String msg;
    private Integer httpCode;

    FriendlyLinkExceptionEnum(Integer code, String msg, Integer httpCode) {
        this.code = code;
        this.msg = msg;
        this.httpCode = httpCode;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    @Override
    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public Integer getHttpCode() {
        return httpCode;
    }

    @Override
    public void setHttpCode(Integer httpCode) {
        this.httpCode = httpCode;
    }

    public static FriendlyLinkExceptionEnum getEnumByCode(Integer code){
        for(FriendlyLinkExceptionEnum roleExceptionEnum : FriendlyLinkExceptionEnum.values()){
            if(code.equals(roleExceptionEnum.getCode())){
                return roleExceptionEnum;
            }
        }
        return null;
    }
}
